#include<cstdio>
#include<cstring>
#include<cstdlib>
#define max(a,b) ((a)>(b)?(a):(b))
using namespace std;
int a[110],k,n,p,low;
void dfs(int last,int group,int now)
{
	if(last<0) return ; 
	if(group==k)
	{
		printf("%d\n",p);
		exit(0);
	}
	if(last==0) dfs(p,group+1,low);
	for(int i=now;i>=1;i--)
	{
		if(a[i]>0)
		{
			if(last-i<0) continue;
			if(group==k)
			{
				printf("%d\n",p);
				exit(0);
			}
			a[i]--;
			dfs(last-i,group,i);
			a[i]++;
			if(last==p) return ;
		}
	}
}
int main()
{
	int x,sum=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		if(x<=50)
		{
			a[x]++;
			sum+=x;
			low=max(low,x);
		}
	}
	for(int s=low;s<=sum/2;s++)
	{
		if(sum%s==0)
		{
			k=sum/s;
			p=s;
			dfs(s,0,low);
		}
	}
	printf("%d\n",sum);
	return 0;
} 
